package com.binyouwei.designpatterns.creation_type.factory;

import java.text.DecimalFormat;

/**
 * @author 宾有为
 * @date 2024/7/17 20:18
 * @link https://blog.csdn.net/baidu_41616022?type=blog
 * @describe：工厂模式 - 定义了一个创建对象的接口，但由子类决定实例化哪个类。工厂方法将对象的创建延迟到子类。
 **/
public class FactoryMain {
    public static void main(String[] args) {
        Factory factoryA = new ConcreteFactoryA();
        FactoryProduct productA = factoryA.createProduct();
        productA.use();

        Factory factoryB = new ConcreteFactoryB();
        FactoryProduct productB = factoryB.createProduct();
        productB.use();

    }
}
